package com.anglireports.service;

import com.alibaba.fastjson.JSONObject;
import com.anglireports.report.data.base.ResponseData;
import com.anglireports.report.data.base.ResponseDataModel;
import com.anglireports.report.data.campusPage.CampusDataUtil;
import com.anglireports.report.data.campusPage.CampusPageResponse;
import com.anglireports.report.data.classPage.ClassDataUtil;
import com.anglireports.report.data.classPage.ClassPageResponse;
import com.anglireports.report.data.common.SelectData;
import com.anglireports.report.data.studentPage.StudentDataUtil;
import com.anglireports.report.data.studentPage.StudentPageResponse;
import com.ibeetl.admin.core.service.BaseService;
import org.springframework.stereotype.Service;

/**
 * @author lvjilei
 * @ceateTime 2019/3/30.
 */
@Service
public class ReportService extends BaseService {

    public String getCampusPageData(String starttime, String endtime, String campusid){
        ResponseDataModel<CampusPageResponse> rs = CampusDataUtil.reponseData(starttime, endtime, campusid);
        return JSONObject.toJSONString(rs);
    }


    public String getClassPageData(String course_id, String starttime, String endtime, String class_id ){
        ResponseDataModel<ClassPageResponse> rs = ClassDataUtil.reponseData(starttime, endtime, course_id, null);
        return JSONObject.toJSONString(rs);
    }


    /**
     * 查询学生页面数据
     * @param starttime
     * @param endtime
     * @param course_id
     * @param student_id
     */
    public String getStudentPageData(String starttime, String endtime,
                                     String course_id,
                                     String student_id){
        ResponseDataModel<StudentPageResponse> rs = StudentDataUtil.responseData(starttime, endtime, course_id, student_id);
        return JSONObject.toJSONString(rs);
    }


    /**
     * 获取下拉列表学校数据
     * @param starttime
     * @param endtime
     * @return
     */
    public String getSeclectCampusData(String starttime, String endtime){
        ResponseData responseData  = SelectData.getCampusData(starttime, endtime);
        return JSONObject.toJSONString(responseData);
    }

    /**
     * 获取下拉列表班级数据
     * @param starttime
     * @param endtime
     * @return
     */
    public String getSeclectClassData(String starttime, String endtime, String campusid, String org_code){
        ResponseData responseData  = SelectData.getCoursesData(starttime, endtime ,campusid ,org_code);
        return JSONObject.toJSONString(responseData);
    }


    /**
     * 获取下拉列表学生数据
     * @param starttime
     * @param endtime
     * @return
     */
    public String getSeclectStudentData(String starttime, String endtime, String courseid, Integer classid){
        ResponseData responseData  = SelectData.getStudentData(starttime, endtime,courseid,classid );
        return JSONObject.toJSONString(responseData);
    }
}
